import logger from 'electron-log'

logger.transports.file.fileName = 'main.log';
logger.transports.console.level = 'debug'
logger.transports.file.level = 'debug'
logger.transports.file.maxSize = 1048576
logger.transports.file.format = '[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}'
/*
on Linux: ~/.config/{app name}/logs/{process type}.log
on macOS: ~/Library/Logs/{app name}/{process type}.log
on Windows: %USERPROFILE%\AppData\Roaming\{app name}\logs\{process type}.log

日志文件目录默认，不同系统会存在不同目录，配置了反而更麻烦.
注意：需要安装包模式才能写入日志
比如 win下面 neurogin应用 C:\Users\Weihan.Chen\AppData\Roaming\neurogin\logs
*/
logger.info('Logger is OK!')

export default {
  info(param) {
    logger.info(param)
  },
  warn(param) {
    logger.warn(param)
  },
  error(param) {
    logger.error(param)
  },
  debug(param) {
    logger.debug(param)
  },
  verbose(param) {
    logger.verbose(param)
  },
  silly(param) {
    logger.silly(param)
  }
}
